package user

import (
	"context"
	"fmt"
	proto "jupiter-demo/internal/app/grpc/user/proto"
	"jupiter-demo/internal/app/service"
	"jupiter-demo/pkg/util"
	"log"
)

type UserInfoServer struct{}

func (userinfoserver *UserInfoServer) GetUserInfo(context context.Context, request *proto.UserInfoFilter) (response *proto.UserInfoRequest, err error) {
	  key :="userinfo-"+string(request.Id)
	  value,err := util.Get(key)
	  if err != nil{
	  	log.Fatal("获取用户信息错误",err)
	  }
	  if value != nil{
	  	//TODO
	  }
	 userinfo:= service.UserRepository.GetUserInfo(int(request.Id))
	 fmt.Println(userinfo)
	   return
}

func (userinfoserver *UserInfoServer) CreateUserInfo(context context.Context, request *proto.UserInfoRequest) (response *proto.UserInfoResponse, err error) {
	panic("implement me")
    return 
}

func (userinfoserver *UserInfoServer) UpdateUserInfo(context context.Context, request *proto.UserInfoRequest) (response *proto.UserInfoResponse, err error) {
	panic("implement me")
    return 
}

